import React, { Suspense, lazy } from 'react';
import { HashRouter as Router, Route, Switch } from 'react-router-dom';
import Loading from '@/component/layout/loading/loading';
import ErrorBoundary from '@/component/common/ErrorBoundary/ErrorBoundary';
import PrivateRoute from './router/PrivateRoute';
import './App.css';

const Login = lazy(() => import('./router/Login/Login'));
const NotFound = lazy(() => import('./router/NotFound/NotFound'));
const Home = lazy(() => import('./router/Home/Home'));
const UserCenter = lazy(() => import('./router/UserCenter/UserCenter'));
const Study = lazy(() => import('./router/Study/Study'));
const Question = lazy(() => import('./router/Question/Question'));
const ProductInfo = lazy(() => import('./router/ProductInfo/ProductInfo'));
const Academic = lazy(() => import('./router/Academic/Academic'));
const Publish = lazy(() => import('./router/Publish/Publish'));
const AcademicDetail = lazy(() => import('./router/AcademicDetail/AcademicDetail'));
const ProDetail = lazy(() => import('./router/ProDetail/ProDetail'));
const CustomerManage = lazy(() => import('./router/CustomerManage/CustomerManage'));
const CustomerList = lazy(() => import('./router/CustomerList/CustomerList'));
const DocList = lazy(() => import('./router/CustomerList/DocList'));
const DocListAnalysis = lazy(() => import('./router/CustomerAnalysis/DocListAnalysis'));
const CustomerAnalysis = lazy(() => import('./router/CustomerAnalysis/CustomerAnalysis'));
// const Questionnaire = lazy(() => import('./router/Questionnaire/Questionnaire'));
const NingJu = lazy(() => import('./router/NingJu/NingJu'));
const StudyRecord = lazy(() => import('./router/StudyRecord/StudyRecord'));
const Memo = lazy(() => import('./router/Memo/Memo'));
const MemoDetail = lazy(() => import('./router/MemoDetail/MemoDetail'));
const Search = lazy(() => import('./router/Search/Search'));
const ModifyPwd = lazy(() => import('./router/ModifyPwd/ModifyPwd'));
const NingGDetail = lazy(() => import('./router/NingGDetail/NingGDetail'));
const MedicalDetail = lazy(() => import('./router/MedicalDetail/MedicalDetail'));
const QianyanDetail = lazy(() => import('./router/QianyanDetail/QianyanDetail'));
const QuestionNaireList = lazy(() => import('./router/QuestionNaireList/QuestionNaireList'));
const MettingSign = lazy(() => import('./router/MettingSign/MettingSign'));
const QuestionDetail = lazy(() => import('./router/QuestionDetail'));
const AnalysismettingList = lazy(() => import('./router/AnalysismettingList/AnalysismettingList'));

// import Home from './router/Home/Home'

function App() {
  return (
    <ErrorBoundary>
      <Suspense fallback={<Loading style={{height:'100vh'}}/>}>
        <Router>
          <Switch>
            {/* <Route exact path="/" component={props=><Home {...props}/>} /> */}
            <PrivateRoute exact path="/" component={Home} />
            <PrivateRoute path="/question" component={Question} />
            <PrivateRoute path="/study" component={Study} />
            <PrivateRoute path="/productInfo" component={ProductInfo} />
            <PrivateRoute path="/userCenter" component={UserCenter} />
            <PrivateRoute path="/academic" component={Academic} />
            <PrivateRoute path="/publish" component={Publish} />
            <PrivateRoute path="/proDetail" component={ProDetail} />
            <PrivateRoute path="/customerManage" component={CustomerManage} />
            <PrivateRoute path="/customerList" component={CustomerList} />
            <PrivateRoute path="/docList" component={DocList} />
            <PrivateRoute path="/docListAnalysis" component={DocListAnalysis} />
            <PrivateRoute path="/customerAnalysis" component={CustomerAnalysis} />
            <PrivateRoute path="/analysismettingList" component={AnalysismettingList} />
            {/* <PrivateRoute path="/questionnaire" component={Questionnaire} /> */}
            {/* <PrivateRoute path="/questionnaire" component={QuestionNaireList} /> */}
            <PrivateRoute path="/ningJu" component={NingJu} />
            <PrivateRoute path="/memo" component={Memo} />
            <PrivateRoute path="/studyRecord" component={StudyRecord} />
            <PrivateRoute path="/memoDetail" component={MemoDetail} />
            <PrivateRoute path="/search" component={Search} />
            <PrivateRoute path="/ningGDetail" component={NingGDetail} />
            <PrivateRoute path="/qianyanDetail" component={QianyanDetail} />
            <PrivateRoute path="/medicalDetail" component={MedicalDetail} />
            {/* <PrivateRoute path="/questionNaireList" component={QuestionNaireList} /> */}
            {/* <PrivateRoute path="/mettingSign" component={MettingSign} /> */}
            <PrivateRoute path="/questionDetail" component={QuestionDetail} />
            <Route path="/modifyPwd" component={props=><ModifyPwd {...props}/>} />
            <Route path="/login" component={props=><Login {...props}/>} />
            <Route path="/academicDetail" component={props=><AcademicDetail {...props}/>} />
            <Route path="/mettingSign" component={props=><MettingSign {...props}/>} />
            <Route path="/questionnaire" component={props=><QuestionNaireList {...props}/>} />
            <Route  component={props=><NotFound {...props}/>} />
          </Switch>
        </Router>
      </Suspense>
    </ErrorBoundary>
  )
}

export default App;
